package com.yzt.base.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModelProperty;

public class BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 库表主键，主键生成机制为雪花算法
	 */
	@TableId(type = IdType.ASSIGN_ID)
	@ApiModelProperty(value = "主键ID", example = "0")
	private Long id;

	/**
	 * 库表记录创建时间，无须赋值，框架自动生成（需要配置文件）
	 */
	@ApiModelProperty(value = "记录创建时间")
	@TableField(fill = FieldFill.INSERT)
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime createTime;

	/**
	 * 库表记录更新时间，无须赋值，框架自动生成（需要配置文件）
	 */
	@ApiModelProperty(value = "记录更新时间")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime updateTime;

	/**
	 * 逻辑删除标识字段 <br>
	 * 默认配置： <br>
	 * 0 表示 未删除 <br>
	 * 1表示 已删除 <br>
	 * 框架查询自动补全SQL语句<br>
	 */
	@TableLogic
	@TableField(fill = FieldFill.INSERT)
	@ApiModelProperty(value = "逻辑删除标识 0 表示 未删除 1表示 已删除 ", example = "0", hidden = true)
	private Integer deleteTag;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public LocalDateTime getCreateTime() {
		return createTime;
	}

	public void setCreateTime(LocalDateTime createTime) {
		this.createTime = createTime;
	}

	public LocalDateTime getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(LocalDateTime updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getDeleteTag() {
		return deleteTag;
	}

	public void setDeleteTag(Integer deleteTag) {
		this.deleteTag = deleteTag;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}
